package com.matrix.basecore.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.viewbinding.ViewBinding

abstract class BaseFragment<T : ViewBinding> : Fragment() {

    lateinit var mViewBinding: T

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        mViewBinding = getViewBinding()
        initView(inflater)
        initData()
        initListener()
        return mViewBinding.root
    }

    abstract fun getViewBinding(): T

    abstract fun initView(inflater: LayoutInflater)

    open fun initData() {}

    open fun initListener() {

    }
}